package cn.ciis.sys.menu;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

/**
 * AccountUpdateValidator 验证角色修改功能表单
 *
 * @author 冉志林
 */
public class MenuAdminValidator extends Validator {

  @Override
  protected void validate(Controller c) {
    setShortCircuit(true);

    validateRequiredString("menu.name", "msg", "名称不能为空");
    // validateRequiredString("menu.superior", "msg", "上级菜单不能为空");
    validateRequiredString("menu.serialNumber", "msg", "序号不能为空");
    validateRequiredString("menu.url", "msg", "地址不能为空");
  }

  @Override
  protected void handleError(Controller c) {
    c.setAttr("state", "fail");
    c.renderJson();
  }
}
